//
// security_editor.h
// gcs
// Grand Central Station, controlling process of the Protea Application Server / Business Logic Transactions for the SAI security editor
// Copyright (C) 2003, 2004, 2005 eXegeSys, Inc.
// Copyright (C) 2008 Bruce A. James
//
// This program is part of the Protea Project.
//
// The Protea Project is free software; you can redistribute it and/or modify it 
// under the terms of the GNU General Public License as published by the 
// Free Software Foundation, either version 3 of the License, or (at your 
// option) any later version.
//
// The Protea Project is distributed in the hope that it will be useful, but 
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
// for more details.
// 
// You should have received a copy of the GNU General Public License along 
// with this program.  If not, see <http://www.gnu.org/licenses/>.
// 
// Please send correspondence to:
// 
// theproteaproject@gmail.com
//

#ifndef __PROTEA_SECURITY_EDITOR_H__
#define __PROTEA_SECURITY_EDITOR_H__

class __EXPORT XCAuthenticateEditor : public XCAuthenticate {
public:
	XCAuthenticateEditor( XCAppInterface* myapp );

	void AddApplication( int app_nbr, bool default_allow_access );
	void AddApplicationItem( XCSecurityItems* items, long item_number, bool default_allow_access );
	void AddApplicationSecurity( XCSecurityRuleList* rules, const char* user_name, bool default_allow_access );
	void RemoveApplicationSecurity( XCSecurityRuleList* rules, const char* user_name );

	void AddGroup( const char* name, const char* description );
	void AddUser( const char* name, const char* password, const char* description );
	void UpdateUser( const char* name, const char* password, const char* description );

	void AddUserToGroup( const char* user_name, const char* group_name );

	void RemoveGroup( const char* name );
	void RemoveUser( const char* name );
	void RemoveUserFromGroup( const char* user_name, const char* group_name );

	void RemoveIndexFromItems( const long index, XCSecurityItems* items );
	void RemoveIndexFromItem( const long index, XCSecurityRuleList* rules );

	void RemoveApplicationItem( XCSecurityItems* items, XCSecurityItem* item );

	void ChangeApplicationSecurity( XCSecurityRuleList* rules, const char* user_name, bool new_value );

	void OutputItems( fstream& output, char* nice, char* name, XCSecurityItems* items );
	void OutputRuleList( fstream& output, char* nice, XCSecurityRuleList* rules );
	void Output();

private:
	XCAppInterface* app;
};

#endif
